using System;
using System.Configuration;
/// <summary>
/// Repository for HunterShop configuration settings
/// </summary>
public static class HunterShopConfiguration
{
    // Caches the connection string
    private static string dbConnectionString;
    // Caches the data provider name
    private static string dbProviderName;
    // Store the number of products per page
    private readonly static int productsPerPage;
    // Store the number of images per page
    private readonly static int imagesPerPage;
    // Store the product description length for product lists
    private readonly static int productDescriptionLength;
    // Store the name of your site
    private readonly static string siteName;
    // Store the number of days for shopping cart expiration
    private readonly static int cartPersistDays;

    static HunterShopConfiguration()
    {
        dbConnectionString =
        ConfigurationManager.ConnectionStrings["HunterShopConnection"].
        ConnectionString;
        dbProviderName =
        ConfigurationManager.ConnectionStrings["HunterShopConnection"].
        ProviderName;
        productsPerPage =
        Int32.Parse(ConfigurationManager.AppSettings["ProductsPerPage"]);
        imagesPerPage =
        Int32.Parse(ConfigurationManager.AppSettings["ImagesPerPage"]);
        productDescriptionLength =
        Int32.Parse(ConfigurationManager.AppSettings["ProductDescriptionLength"]);
        siteName = ConfigurationManager.AppSettings["SiteName"];
        cartPersistDays = Int32.Parse(ConfigurationManager.AppSettings["CartPersistDays"]);
    }
    // Returns the connection string for the HunterShop database
    public static string DbConnectionString
    {
        get
        {
            return dbConnectionString;
        }
    }
    // Returns the data provider name
    public static string DbProviderName
    {
        get
        {
            return dbProviderName;
        }
    }
    // Returns the address of the mail server
    public static string MailServer
    {
        get
        {
            return ConfigurationManager.AppSettings["MailServer"];
        }
    }
    // Send error log emails?
    public static bool EnableErrorLogEmail
    {
        get
        {
            return bool.Parse(ConfigurationManager.AppSettings
            ["EnableErrorLogEmail"]);
        }
    }
    // Returns the email address where to send error reports
    public static string ErrorLogEmail
    {
        get
        {
            return ConfigurationManager.AppSettings["ErrorLogEmail"];
        }
    }

    // ErrorEmailAddress
    public static string ErrorEmailAddress
    {
        get
        {
            return ConfigurationManager.AppSettings["ErrorEmailAddress"];
        }
    }

    // ErrorEmailPassword
    public static string ErrorEmailPassword
    {
        get
        {
            return ConfigurationManager.AppSettings["ErrorEmailPassword"];
        }
    }

    // hunterShopEmailAddress
    public static string HunterShopEmailAddress
    {
        get
        {
            return ConfigurationManager.AppSettings["HunterShopEmailAddress"];
        }
    }

    // HunterShopEmailPassword
    public static string HunterShopEmailPassword
    {
        get
        {
            return ConfigurationManager.AppSettings["HunterShopEmailPassword"];
        }
    }

    // Returns the maximum number of products to be displayed on a page
    public static int ProductsPerPage
    {
        get
        {
            return productsPerPage;
        }
    }

    // Returns the maximum number of images to be displayed on a page
    public static int ImagesPerPage
    {
        get
        {
            return imagesPerPage;
        }
    }
    // Returns the length of product descriptions in products lists
    public static int ProductDescriptionLength
    {
        get
        {
            return productDescriptionLength;
        }
    }
    public static string SiteName
    {
        get
        {
            return siteName;
        }
    }
    // Returns the number of days for shopping cart expiration
    public static int CartPersistDays
    {
        get
        {
            return cartPersistDays;
        }
    }
}